const baiduAiBaseUrl = 'https://aip.baidubce.com'

// 用户-获取当前登录用户的基本信息
let getUserInfo = '/userLogin/getUserInfo';
// 用户-获取当前登录用户的邀请码信息
let getUserInviteCode = '/userInfo/getUserInviteCode';
// 通过code换openId
let getWechatOpenId = '/userLogin/getWechatOpenId'
// 通过快手code换openId
let getKsOpenId = '/userLogin/ksAuth'
//更新快手用户信息
let updateksUserInfo = '/userLogin/ksUserInfo'
// 判断是否登录
let isLogin = '/userLogin/isLogin';
// 注册-提交注册
let registerUser = '/userRegister/registerUser';
// 注册-获取验证码
let mobileCode = '/userRegister/mobileCode';
// 登录-手机验证码
let login = '/userLogin/login';
// 快手手机号
let ksPhone = '/userLogin/ksPhone'
// 登录-密码登录
let loginCheck = '/userLogin/loginCheck';
// APP版本管理-查询最新版本
let findNewVersionInfo = '/app/findNewVersionInfo';
// 退出登录
let logout = '/userLogin/logout';
// 用户-修改个人基本信息
let changeInfo = '/userInfo/changeInfo';
// 我的钱包-查询用户资金统计信息
let findUserCapitalInfo = '/userCapital/findUserCapitalInfo/v1.0';
// 地址管理-查询收货地址列表
let findAddressList = '/userAddress/findAddressList';
// 地址管理-删除收货地址
let deleteUserAddress = '/userAddress/deleteUserAddress';
// 地址管理-新增收货地址
let addUserAddress = '/userAddress/addUserAddress';
// 地址管理-编辑收货地址
let editUserAddress = '/userAddress/editUserAddress';
// 地址管理-设为默认收货地址
let setDefaultAddress = '/userAddress/setDefaultAddress';
// 用户-设置交易密码
let updateTransPassword = '/userInfo/updateTransPassword';
// 验证短信验证码是否正确
let checkMobileCode = '/userInfo/checkMobileCode';
// 用户资金-查询用户余额总额及记录
let findUserBalance = '/userCapital/findUserBalance/v1.0';
// 用户资金-用户充值
let topUp = '/userCapital/topUp/v1.0';
// 用户资金-用户提现
let withdrawal = '/userCapital/withdrawal/v1.0';
// 用户资金-用户充值记录
let topUpRecord = '/userCapital/topUpRecord/v1.0';
// 用户资金-用户提现记录
let withdrawalRecord = '/userCapital/withdrawalRecord/v1.0';
// 首页-banner
let banner = '/home/banner/v1.0';
// 首页-分类列表
let goodsTypeList = '/home/goodsTypeList/v1.0';
// 首页-新品首发
let newProduct = '/home/newProduct/v1.0';
// 首页-精品推荐
let boutique = '/home/boutique/v1.0';
// 首页-所有商城所有分类
let queryAllMallGoodsTypeList = '/home/queryAllMallGoodsTypeList/v1.0';
// 首页-查询商品详情
let findGoodsDetail = '/home/findGoodsDetail/v1.0';
// 首页-查询商品详情运费金额
let queryFreightPrice = '/home/queryFreightPrice/v1.0';
// 地址管理-查询用户默认地址
let queryDefaultAddress = '/userAddress/queryDefaultAddress';
// 商城订单-创建订单
let createOrderMall = '/orderMall/createOrderMall/v1.0';
// 查询快递信息
let getDeliveryRouters = '/orderMall/getDeliveryRouters/v1.0'
// 商城订单-订单支付
let payOrderMall = '/orderMall/payOrderMall/v1.0';
// 用户-校验交易密码是否存在
let checkTransPassword = '/userInfo/checkTransPassword';
// 商城订单-查询订单列表
let findOrderMallList = '/orderMall/findOrderMallList/v1.0';
// 商城订单-取消订单（待付款 待发货）
let orderCancel = '/orderMall/orderCancel/v1.0';
// 商城订单-确认收货
let confirmReceipt = '/orderMall/confirmReceipt/v1.0';
// 商城订单-删除订单
let deleteOrderMall = '/orderMall/deleteOrderMall/v1.0';
// 商城订单-查询订单详情
let getOrderMallById = '/orderMall/getOrderMallById/v1.0';
// 配置管理-根据key查询配置信息
let findConfigByKey = '/config/findConfigByKey';
// 配置管理-根据type查询配置信息列表
let findConfigByType = '/config/findConfigByType';
// 会员商品-商品列表
let findList = '/goodsVip/findList';
// 会员商品-商品详情
let findInfo = '/goodsVip/findInfo';
// 会员订单-创建订单
let createOrderVip = '/orderVip/createOrderVip/v1.0';
// 会员订单-订单支付
let payOrderVip = '/orderVip/payOrderVip/v1.0';
// 我的红包-查询用户可领取红包
let findUserShare = '/userCapital/findUserShare/v1.0';
// 我的红包-查询用户领取红包记录
let findUserShareRecord = '/userCapital/findUserShareRecord/v1.0';
// 用户资金-查询用户积分总额及记录
let findUserIntegral = '/userCapital/findUserIntegral/v1.0';
// 会员订单-会员订单列表查询
let findOrderVipList = '/orderVip/findOrderVipList/v1.0';
// 用户资金-用户领取红包
let receiveShare = '/userCapital/receiveShare/v1.0';
// 会员订单-确认收货
let confirmVipReceipt = '/orderVip/confirmReceipt/v1.0';
// 用户-我的推荐-社区统计
let communityCount = '/userInfo/communityCount/v1.0';
// 会员订单-订单详情查询
let getOrderVipById = '/orderVip/getOrderVipById/v1.0';
// 首页-根据分类ID查询商品列表
let findGoodsListByType = '/home/findGoodsListByType/v1.0';
// 首页-搜索
let searchMallGoods = '/home/searchMallGoods/v1.0';
// 商城订单-查询统计订单状态数量
let findOrderMallCount = '/orderMall/findOrderMallCount/v1.0';
// 消息-查询最新未读消息
let getUnReadNum = '/message/getUnReadNum';
// 消息-查询详情
let getInfo = '/message/getInfo';
// 消息-读取消息
let readMessage = '/message/readMessage';
// 消息-查询列表
let findMessageList = '/message/findList';
// 用户忘记密码（无需登录）
let forgetPassword = '/userInfo/forgetPassword';
// 用户修改密码
let updatePassword = '/userInfo/updatePassword';
// 会员订单-获取支付方式
let getPayType = '/orderVip/getPayType/v1.0';
// 会员订单-在线支付（微信）
let wxPayOrder = '/orderVip/wxPayOrder/v1.0';
// 会员订单-在线支付（支付宝）
let aliPayOrder = '/orderVip/aliPayOrder/v1.0';
// 商城订单-获取支付方式
let getMallPayType = '/orderMall/getPayType/v1.0';
// 商城订单-在线支付（微信）
let getMallWxPayOrder = '/orderMall/wxPayOrder/v1.0';
// 商城订单-在线支付（支付宝）
let getMallAliPayOrder = '/orderMall/aliPayOrder/v1.0';
// 活动弹框-查询活动弹框
let findActivityBounced = '/config/findActivityBounced';
// 用户-用户签到
let toUserSignIn = '/userInfo/toUserSignIn';
// 用户-校验用户今日是否已签到
let checkUserIsSignInToday = '/userInfo/checkUserIsSignInToday';
//加入购物车
let addShoppingCart = '/shoppingCart/addShoppingCart';
//购物车列表
let shoppingfindList = '/shoppingCart/findList';
//购物车数量修改
let updateShoppingCart = '/shoppingCart/updateShoppingCart';
//删除商品
let removeShoppingCart = '/shoppingCart/removeShoppingCart';
//购物车生成订单
let shoppingCartBuyMallGoods = '/orderMall/shoppingCartBuyMallGoods/v1.0';
//店铺信息
let findMallDetail = '/home/findMallDetail/v1.0';
// 获取套餐信息
let findVaildVoucherList = '/app/voucher/findVaildVoucherList/v1.0'
// 核销
let writeOffVoucherList = '/app/voucher/writeOff/v1.0'

// 百度 token
let baiduToken = `${baiduAiBaseUrl}/oauth/2.0/token`
// 百度 address
let baiduAddress = `/userAddress/autoAddress`


// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处没有使用传入的params参数
	let postGetUserInfo = (params = {}) => vm.$u.post(getUserInfo, params);
	let postGetWechatOpenId = (params = {}) => vm.$u.post(getWechatOpenId, params);
	let postGetKsOpenId = (params = {}) => vm.$u.post(getKsOpenId, params);
	let postKsPhone = (params = {}) => vm.$u.post(ksPhone, params);
	let postUpdateksUserInfo = (params = {}) => vm.$u.post(updateksUserInfo, params);
	let postIsLogin = (params = {}) => vm.$u.post(isLogin, params);
	let postRegisterUser = (params = {}) => vm.$u.post(registerUser, params);
	let postMobileCode = (params = {}) => vm.$u.post(mobileCode, params);
	let postLogin = (params = {}) => vm.$u.post(login, params);
	let postGetUserInviteCode = (params = {}) => vm.$u.post(getUserInviteCode, params);
	let postFindNewVersionInfo = (params = {}) => vm.$u.post(findNewVersionInfo, params);
	let postLogout = (params = {}) => vm.$u.post(logout, params);
	let postLoginCheck = (params = {}) => vm.$u.post(loginCheck, params);
	let postChangeInfo = (params = {}) => vm.$u.post(changeInfo, params);
	let postFindUserCapitalInfo = (params = {}) => vm.$u.post(findUserCapitalInfo, params);
	let postFindAddressList = (params = {}) => vm.$u.post(findAddressList, params);
	let postDeleteUserAddress = (params = {}) => vm.$u.post(deleteUserAddress, params);
	let postAddUserAddress = (params = {}) => vm.$u.post(addUserAddress, params);
	let postEditUserAddress = (params = {}) => vm.$u.post(editUserAddress, params);
	let postSetDefaultAddress = (params = {}) => vm.$u.post(setDefaultAddress, params);
	let postUpdateTransPassword = (params = {}) => vm.$u.post(updateTransPassword, params);
	let postCheckMobileCode = (params = {}) => vm.$u.post(checkMobileCode, params);
	let postFindUserBalance = (params = {}) => vm.$u.post(findUserBalance, params);
	let postTopUp = (params = {}) => vm.$u.post(topUp, params);
	let postWithdrawal = (params = {}) => vm.$u.post(withdrawal, params);
	let postTopUpRecord = (params = {}) => vm.$u.post(topUpRecord, params);
	let postWithdrawalRecord = (params = {}) => vm.$u.post(withdrawalRecord, params);
	let postBanner = (params = {}) => vm.$u.post(banner, params);
	let postGoodsTypeList = (params = {}) => vm.$u.post(goodsTypeList, params);
	let postNewProduct = (params = {}) => vm.$u.post(newProduct, params);
	let postBoutique = (params = {}) => vm.$u.post(boutique, params);
	let postQueryAllMallGoodsTypeList = (params = {}) => vm.$u.post(queryAllMallGoodsTypeList, params);
	let postFindGoodsDetail = (params = {}) => vm.$u.post(findGoodsDetail, params);
	let postQueryFreightPrice = (params = {}) => vm.$u.post(queryFreightPrice, params);
	let postQueryDefaultAddress = (params = {}) => vm.$u.post(queryDefaultAddress, params);
	let postCreateOrderMall = (params = {}) => vm.$u.post(createOrderMall, params);
	let postPayOrderMall = (params = {}) => vm.$u.post(payOrderMall, params);
	let postCheckTransPassword = (params = {}) => vm.$u.post(checkTransPassword, params);
	let postFindOrderMallList = (params = {}) => vm.$u.post(findOrderMallList, params);
	let postOrderCancel = (params = {}) => vm.$u.post(orderCancel, params);
	let postConfirmReceipt = (params = {}) => vm.$u.post(confirmReceipt, params);
	let postDeleteOrderMall = (params = {}) => vm.$u.post(deleteOrderMall, params);
	let postGetOrderMallById = (params = {}) => vm.$u.post(getOrderMallById, params);
	let postFindConfigByKey = (params = {}) => vm.$u.post(findConfigByKey, params);
	let postFindConfigByType = (params = {}) => vm.$u.post(findConfigByType, params);
	let postFindList = (params = {}) => vm.$u.post(findList, params);
	let postFindInfo = (params = {}) => vm.$u.post(findInfo, params);
	let postCreateOrderVip = (params = {}) => vm.$u.post(createOrderVip, params);
	let postPayOrderVip = (params = {}) => vm.$u.post(payOrderVip, params);
	let postFindUserShare = (params = {}) => vm.$u.post(findUserShare, params);
	let postFindUserShareRecord = (params = {}) => vm.$u.post(findUserShareRecord, params);
	let postFindUserIntegral = (params = {}) => vm.$u.post(findUserIntegral, params);
	let postFindOrderVipList = (params = {}) => vm.$u.post(findOrderVipList, params);
	let postReceiveShare = (params = {}) => vm.$u.post(receiveShare, params);
	let postConfirmVipReceipt = (params = {}) => vm.$u.post(confirmVipReceipt, params);
	let postCommunityCount = (params = {}) => vm.$u.post(communityCount, params);
	let postGetOrderVipById = (params = {}) => vm.$u.post(getOrderVipById, params);
	let postFindGoodsListByType = (params = {}) => vm.$u.post(findGoodsListByType, params);
	let postSearchMallGoods = (params = {}) => vm.$u.post(searchMallGoods, params);
	let postFindOrderMallCount = (params = {}) => vm.$u.post(findOrderMallCount, params);
	let postGetUnReadNum = (params = {}) => vm.$u.post(getUnReadNum, params);
	let postGetInfo = (params = {}) => vm.$u.post(getInfo, params);
	let postReadMessage = (params = {}) => vm.$u.post(readMessage, params);
	let postFindMessageList = (params = {}) => vm.$u.post(findMessageList, params);
	let postForgetPassword = (params = {}) => vm.$u.post(forgetPassword, params);
	let postUpdatePassword = (params = {}) => vm.$u.post(updatePassword, params);
	let postGetPayType = (params = {}) => vm.$u.post(getPayType, params);
	let postWxPayOrder = (params = {}) => vm.$u.post(wxPayOrder, params);
	let postaliPayOrder = (params = {}) => vm.$u.post(aliPayOrder, params);
	let postGetMallPayType = (params = {}) => vm.$u.post(getMallPayType, params);
	let postGetMallWxPayOrder = (params = {}) => vm.$u.post(getMallWxPayOrder, params);
	let getGetDeliveryRouters = (params = {}) => vm.$u.get(getDeliveryRouters, params);
	let postGetMallAliPayOrder = (params = {}) => vm.$u.post(getMallAliPayOrder, params);
	let postFindActivityBounced = (params = {}) => vm.$u.post(findActivityBounced, params);
	let postToUserSignIn = (params = {}) => vm.$u.post(toUserSignIn, params);
	let postCheckUserIsSignInToday = (params = {}) => vm.$u.post(checkUserIsSignInToday, params);
	let postaddShoppingCart = (params = {}) => vm.$u.post(addShoppingCart, params);
	let postShoppingFindList = (params = {}) => vm.$u.post(shoppingfindList, params);
	let postupdateShoppingCart = (params = {}) => vm.$u.post(updateShoppingCart, params);
	let postremoveShoppingCart = (params = {}) => vm.$u.post(removeShoppingCart, params);
	let postshoppingCartBuyMallGoods = (params = {}) => vm.$u.post(shoppingCartBuyMallGoods, params);
	let postFindMallDetail = (params = {}) => vm.$u.post(findMallDetail, params);
	let postFindVaildVoucherList = (params = {}) => vm.$u.post(findVaildVoucherList, params);
	let postWriteOffVoucherList = (params = {}) => vm.$u.post(writeOffVoucherList, params);
	let getBaiduToken = (params = {}) => vm.$u.get(baiduToken, params);
	let postBaiduAddress = (params = {}) => vm.$u.post(baiduAddress, params)

	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {
		postKsPhone,
		postFindMallDetail,
		postGetUserInfo,
		postGetWechatOpenId,
		postGetKsOpenId,
		postIsLogin,
		postRegisterUser,
		postMobileCode,
		postLogin,
		postGetUserInviteCode,
		postFindNewVersionInfo,
		postLogout,
		postLoginCheck,
		postChangeInfo,
		postFindUserCapitalInfo,
		postFindAddressList,
		postDeleteUserAddress,
		postAddUserAddress,
		postEditUserAddress,
		postSetDefaultAddress,
		postUpdateTransPassword,
		postCheckMobileCode,
		postFindUserBalance,
		postTopUp,
		postWithdrawal,
		postTopUpRecord,
		postWithdrawalRecord,
		postBanner,
		postGoodsTypeList,
		postNewProduct,
		postBoutique,
		postQueryAllMallGoodsTypeList,
		postFindGoodsDetail,
		postQueryFreightPrice,
		postQueryDefaultAddress,
		postCreateOrderMall,
		postPayOrderMall,
		postCheckTransPassword,
		postFindOrderMallList,
		postOrderCancel,
		postConfirmReceipt,
		postDeleteOrderMall,
		postGetOrderMallById,
		postFindConfigByKey,
		postFindConfigByType,
		postFindList,
		postFindInfo,
		postCreateOrderVip,
		postPayOrderVip,
		postFindUserShare,
		postFindUserShareRecord,
		postFindUserIntegral,
		postFindOrderVipList,
		postReceiveShare,
		postConfirmVipReceipt,
		postCommunityCount,
		postGetOrderVipById,
		postFindGoodsListByType,
		postSearchMallGoods,
		postFindOrderMallCount,
		postGetUnReadNum,
		postGetInfo,
		postReadMessage,
		postFindMessageList,
		postForgetPassword,
		postUpdatePassword,
		postGetPayType,
		postWxPayOrder,
		postaliPayOrder,
		postGetMallPayType,
		postGetMallWxPayOrder,
		postGetMallAliPayOrder,
		postFindActivityBounced,
		postToUserSignIn,
		postCheckUserIsSignInToday,
		postaddShoppingCart,
		postShoppingFindList,
		postupdateShoppingCart,
		postremoveShoppingCart,
		postshoppingCartBuyMallGoods,
		postFindVaildVoucherList,
		postUpdateksUserInfo,
		postWriteOffVoucherList,
		getGetDeliveryRouters,
		getBaiduToken,
		postBaiduAddress
	};
}

export default {
	install
}